package org.codetranslators.common;

import java.util.HashMap;
import java.util.Vector;

public class SpanningTree {

	private HashMap nodeVsSpanningTreeNode;
	private Vector visitedNodes;
	private SpanningTreeNode spanningTreeRoot;
	
	public void setGraphNodeVsSpanningTreeNode(HashMap nodeVsSpanningTreeNode){
		this.nodeVsSpanningTreeNode = nodeVsSpanningTreeNode;
	}
	
	public Node getParentInTree(Node graphNode){
		SpanningTreeNode stNode = (SpanningTreeNode)nodeVsSpanningTreeNode.get(graphNode);
		SpanningTreeNode parentSTNode = (SpanningTreeNode)stNode.getParent();
		return parentSTNode.getGraphNode();
	}
	
	public int getDepthFirstNumber(Node node){
		SpanningTreeNode stNode = (SpanningTreeNode)nodeVsSpanningTreeNode.get(node);
		return stNode.getDepthNumber();
	}

	public void setVisitedNodes(Vector visitedNodes) {
		this.visitedNodes = visitedNodes;
	}
	
	public Node getVisitedNode(int index){
		SpanningTreeNode stNode = (SpanningTreeNode)visitedNodes.elementAt(index);
		return stNode.getGraphNode();
	}

	public void setSpanningTreeRoot(SpanningTreeNode spanningTreeRoot) {
		this.spanningTreeRoot = spanningTreeRoot;
	}
	
}
